package com.code1030.staticCode;

public class Student {
    private String id;
    private String name;
    private int age;
    private String gender;
    //static的存储区域是静态存储位置 堆内存中 跟对象的地址值区分开
    //static修饰的成员变量是随着类的加载而加载的，而不是随着对象的创建而加载的
    //static可以修饰一个类成员属性被所有被构造出来的对象共享
    static String techerName;

    public Student() {
    }
    public Student(String id, String name, int age, String gender) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public Student(String id, String name, int age, String gender, String techerName) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    // 非静态方法
    public void methods1(){
        System.out.println("我是方法1");
    }

    // 静态方法
    public static void methods2(){
        System.out.println("我是方法2");
    }

    public void show(){
        System.out.println("我是" + name + "，我今年" + age + "岁，我是" + gender + "，我的老师是" + techerName);
    }

    public void study() {
        System.out.println("我是" + name + "，我正在学习");
    }


    /**
     * 获取
     * @return id
     */
    public String getId() {
        return id;
    }

    /**
     * 设置
     * @param id
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 获取
     * @return gender
     */
    public String getGender() {
        return gender;
    }

    /**
     * 设置
     * @param gender
     */
    public void setGender(String gender) {
        this.gender = gender;
    }

    public String toString() {
        return "Student{id = " + id + ", name = " + name + ", age = " + age + ", gender = " + gender + "}";
    }

    /**
     * 获取
     * @return techerName
     */
    public String getTecherName() {
        return techerName;
    }

    /**
     * 设置
     * @param techerName
     */
    public void setTecherName(String techerName) {
        this.techerName = techerName;
    }
}
